package com.itheima.homework;

/**
 * @Author 王加鑫
 * @Date 2021/4/22 19:09
 * @Version 1.0
 * 12、【编号：315】 我国最高的山峰是珠穆朗玛峰，高8848米。一张纸的厚度是0.4毫米。
 * 请问，在理论情况下，一张纸折叠多少次可以超越珠峰的高度？
 */
public class Day05HomeWork12 {
    public static void main(String[] args) {
        int count = foldPaper(8848000,0.4);
        System.out.println("一张纸折叠"+count+"次可以超越珠峰的高度");

    }

    public static int foldPaper(double mountainHeight,double paperHeight){
        //折叠次数
        int count = 0;
        while (paperHeight <= mountainHeight){
            paperHeight *=2;
            count++;
        }
        return count;
    }
}
